{% load staticfiles %}
<!DOCTYPE html>
<html>

<head>
    <link rel="stylesheet" type="text/css" href="{% static 'login/css/skin_/main.css' %}" />
    <script type="text/javascript" src="{% static 'login/js/jquery.js' %}"></script>
</head>

<body>
    <div id="header">
        <h1>十露盘数据服务平台</h1>
    </div>
    <div id="nav">
        <ul>
            <li>
                <a href="">数据下载</a> <br>
                <ul class="submenu">
                    <li> <a href="{% url 'ddm:post' username %}"> 编辑任务 </a> </li>
                    <li> <a href="{% url 'ddm:result' username 7 %}" class="active">任务进度 </a> </li>
                    <li> <a href="{% url 'login:logout'%}"> 用户注销 </a> </li>
                </ul>
            </li>
        </ul>
    </div>
    <div id="section">
        <h2> 最近七天任务列表展示</h2>
        <div class="nav-tab">
            <a href="{% url 'ddm:post' username %}"> 继续添加任务 </a>
            <a href="{% url 'ddm:result' username 30 %}"> 显示近期30天 </a>
        </div>
        <div id="box">
            <table class="dataintable" cellspacing="0" >
                <tbody>
                    <tr>
                        <th>任务 ID</th>
                        <th>任务名称</th>
                        <th>申请人</th>
                        <th>申请时间</th>
                        <th>审批人</th>
                        <th>审批结果</th>
                        <th>审批理由</th>
                        <th>任务状态</th>
                        <th>成功下载</th>
                        <th>回执邮件</th>
                    </tr>
                    <tr>
                        {% for task in tasks %}
                            <tr>
                                <td width="350">
                                    <a href="{% url 'ddm:detail' username task.task_id %}">{{ task.task_id }}</a>
                                </td>
                                <td width="100"> {{ task.task_name }} </td>
                                <td width="100"> {{ task.username }} </td>
                                <td width="100"> {{ task.apply_time|date:"Y-m-d"}} {{task.apply_time|time:"H:i:s"}}</td>
                                <td width="100"> {{ task.approver }} </td>
                                <td width="100"> {{ task.approval }} </td>
                                <td width="100"> {{ task.reason }} </td>
                                <td width="100"> {{ task.status }} </td>
                                <td width="100"> {{ task.success_rate }} </td>
                                <td width="100"> {{ task.receipt_mail }} </td>
                            </tr>
                        {% endfor %}
                    </tr>
                </tbody>
            </table>
        </div>

        <div id="pages" class="text-center" >
            <nav>
                <ul class="pagination">
                    <li class="step-links">
                    {% if tasks.has_previous %}
                        <a class='active' href="?page={{ tasks.previous_page_number }}">上一页</a>
                    {% endif %}

                    <span class="current">
                        第 {{ tasks.number }} 页 共 {{ tasks.paginator.num_pages }} 页</span>

                    {% if tasks.has_next %}
                        <a class='active' href="?page={{ tasks.next_page_number }}">下一页</a>
                    {% endif %}
                    </li>
                </ul>
            </nav>
        </div>

    </div>
    <div id="footer">
    Copyright slooptech.com
    </div>
<script type="text/javascript">
    console.log($(window).width(),$("#nav").width());
    $("#nav").height($(window).height()-$("#header").height()-$("#footer").height()-31);
    $("#section").width($(window).width()-$("#nav").width()-12);
    $("#section").height($(window).height()-$("#header").height()-$("#footer").height()-31);
</script>

</body>

</html>
